package com.ltedu.common.enums;

/**
 * @ClassName: ErrorCodeEnum
 * @Auther: Jerry
 * @Date: 2020/11/14 11:41
 * @Desctiption: TODO
 * @Version: 1.0
 */
public enum ErrorCodeEnum {

    SUCCESS(200, "请求成功"),
    SERVER_ERROR(10001, "服务器异常"),
    ERROR(10002, "未知错误"),
    VALIDATE_ERROR(10003, "验证异常"),
    FEIGN_INVOKE_ERROR(10004, "feign调用异常"),
    PARAM_NAME_NOT_NULL(10005, "参数不能为空"),
    VALID_PARAM_NAME_NOT_NULL(10006, "校验参数不能为空"),

    // 用户模块错误码
    INVALID_SESSION(11000, "无效的session"),
    MOBILE_IS_REGISTERED(11001, "该手机号已注册"),
    USERNAME_IS_REGISTERED(11002,"该用户已注册"),
    SAVE_USER_FAIL(11003, "新增用户失败"),
    UPDATE_USER_FAIL(11004, "修改用户失败"),
    SAVE_USER_ROLE_FAIL(11005, "新增用户角色失败"),
    USER_NOT_FOUND(11006, "用户不存在"),
    LIMIT_LOGIN_FAIL(11007, "限制登录"),
    REGISTERED_FAIL(11008, "注册失败"),
    LOGIN_FAIL(11009, "登录失败"),
    PASSWORD_ERROR(11010, "用户名或密码错误"),
    OLD_PASSWORD_ERROR(11010, "旧密码错误"),
    TWO_INPUT_PASSWORD_NOT_MATCH(11012, "两次输入密码不一致"),
    USER_DISABLED(11013, "用户已被禁用，请联系管理员"),
    USER_ACCESS_UNAUTHORIZED(11014, "访问未授权"),
    TOKEN_INVALID_OR_EXPIRED(11015, "token无效或已过期"),
    CLIENT_ID_NOT_NULL(11016, "客户端ID不能为空"),

    // 角色模块错误码
    SAVE_ROLE_FAIL(12000, "新增角色失败"),
    UPDATE_ROLE_FAIL(12000, "修改角色失败"),
    USER_ROLE_NOT_FOUND(12002, "未查询到用户角色信息"),
    ROLE_NOT_FOUND(12003, "未查询到角色信息"),

    // 菜单模块错误码
    SAVE_MENU_FAIL(12004, "新增菜单失败"),
    UPDATE_MENU_FAIL(12005, "修改菜单失败"),
    SAVE_MENU_USER_FAIL(12006, "授权权限失败"),
    EXIST_SUBMENU(12007, "存在子菜单,不允许删除"),
    MENU_ASSIGNED(12008, "菜单已分配,不允许删除"),

    // 短信模块错误码
    MOBILE_IS_NOT_NULL(13000,"手机号不能为空"),
    SMS_SENDING_FAIL(13001, "短信发送失败"),
    SMS_CODE_ERROR(13002, "验证码不正确"),

    // 文件上传模块错误码
    NOT_FILE(14000, "未选择文件"),
    INVALID_FILE_TYPE(14001, "无效文件类型"),
    FILE_SIZE_LIMIT(14002, "文件大小超过限制"),
    FILE_UPLOAD_ERROR(14003, "文件上传失败"),
    QINIU_CONFIG_ERROR(14004, "请先在后台设置七牛云配置信息"),

    // 课程模块错误码
    SAVE_COURSE_FAIL(15000, "新增课程失败"),
    SAVE_COURSE_INTRODUCE_FAIL(15001, "新增课程介绍失败"),

    EXIST_SUBCATEGORY(15008, "存在子分类,不允许删除"),
    CATEGORY_IS_USED(15009, "分类已被使用,不允许删除"),
    ;

    ErrorCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private int code;
    private String message;

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public String fillParam(String xError, boolean b) {
        return xError;
    }

    public String fillArgs(String contentUTF8) {
        return contentUTF8;
    }
}
